import { NestFactory } from '@nestjs/core'
import { Logger } from '@nestjs/common'
import { AppModule } from './app.module'
import { NestExpressApplication } from '@nestjs/platform-express'
import { setupApp } from './setup'
declare const module: any

async function bootstrap() {
  const app = await NestFactory.create<NestExpressApplication>(AppModule)
  setupApp(app)
  if (module?.hot) {
    module.hot.accept()
    module.hot.dispose(() => app.close())
  }
  await app.listen(3000, () => {
    Logger.warn('listening to http://localhost:3000')
  })
}
bootstrap()
